﻿<UserControl x:Class="Pathfinder.UI.Views.PathfinderControlView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"  
             xmlns:MenuTree="clr-namespace:Rhodes.WpfSandbox.MenuTree"
             mc:Ignorable="d" 
             xmlns:vc="clr-namespace:Pathfinder.UI.ValueConverters"
             d:DesignHeight="500" d:DesignWidth="300">
    
    <UserControl.Resources>
        
        <!-- Converters -->
        <vc:InverseBooleanConverter x:Key="InverseBooleanConverter"/>
        <vc:EnumBooleanConverter x:Key="EnumBooleanConverter"/>
        
        <Style TargetType="GroupBox" x:Key="GroupBoxMargin">
            <Setter Property="Margin" Value="2"/>
            <Setter Property="MaxWidth" Value="200"/>
        </Style>

        <!-- Style for all the radio buttons on this screen. -->
        <Style TargetType="RadioButton" x:Key="PathfinderRadioButton" BasedOn="{StaticResource {x:Type ToggleButton}}">
            <Setter Property="Width" Value="32"/>
            <Setter Property="Height" Value="32"/>
            <Setter Property="Margin" Value="2"/>
            <Setter Property="Padding" Value="0"/>
        </Style>

        <!-- Menu View -->
        <DataTemplate DataType="{x:Type MenuTree:MenuHostViewModel}">
            <MenuTree:MenuHostView/>
        </DataTemplate>

    </UserControl.Resources>
    
    <StackPanel Margin="10">

        <!-- Command Menu -->
        <GroupBox Header="Command Menu" Style="{StaticResource GroupBoxMargin}">
            <ContentControl MinHeight="80" Content="{Binding MenuHost}"/>
        </GroupBox>
        
        <!-- Movement Mode Buttons -->
        <GroupBox Header="Pathfinder Movement" Style="{StaticResource GroupBoxMargin}">
            <StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Center">

                <RadioButton ToolTip="4 Direction Movement" 
                                Style="{StaticResource PathfinderRadioButton}"
                                IsChecked="{Binding ExploreMode, Converter={StaticResource EnumBooleanConverter}, ConverterParameter=FourDirection}">
                    <Image Source="/Pathfinder.UI;component/Resources/FourWayMovementLarge.png"/>
                </RadioButton>

                <RadioButton ToolTip="8 Direction Movement" 
                            Style="{StaticResource PathfinderRadioButton}"
                                IsChecked="{Binding ExploreMode, Converter={StaticResource EnumBooleanConverter}, ConverterParameter=EightDirection}">
                    <Image Source="/Pathfinder.UI;component/Resources/EightWayMovementLarge.png"/>
                </RadioButton>

            </StackPanel>
        </GroupBox>

        <!-- Blocked Diagonal Buttons -->
        <GroupBox Header="Cost Calculator" Style="{StaticResource GroupBoxMargin}">
            <StackPanel Orientation="Vertical">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="5">

                    <RadioButton ToolTip="8 Direction Movement" 
                            Style="{StaticResource PathfinderRadioButton}"
                            IsChecked="{Binding BlockPartialDiagonals, Converter={StaticResource InverseBooleanConverter}}">
                        <Image Source="/Pathfinder.UI;component/Resources/EightWayMovementWithoutBlockLarge.png"/>
                    </RadioButton>

                    <RadioButton ToolTip="8 Direction Movement With Corner Blocking" 
                            Style="{StaticResource PathfinderRadioButton}"
                            IsChecked="{Binding BlockPartialDiagonals}">
                        <Image Source="/Pathfinder.UI;component/Resources/EightWayMovementWithBlockLarge.png"/>
                    </RadioButton>

                </StackPanel>
            
                <Grid Width="150">
                    
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="75"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>

                    <Label Grid.Row="0" Grid.Column="0" Content="Edges:"/>
                    <Label Grid.Row="1" Grid.Column="0" Content="Diagonals:"/>

                    <xctk:IntegerUpDown Grid.Row="0" Grid.Column="1" Value="{Binding EdgeMovementCost}" Minimum="1" Margin="1" ToolTip="Set the cost of horizontal and vertical movement."/>
                    <xctk:IntegerUpDown Grid.Row="1" Grid.Column="1" Value="{Binding DiagonalMovementCost}" Minimum="1" Margin="1" ToolTip="Set the cost of diagonal movement."/>
                    
                </Grid>
            </StackPanel>
        </GroupBox>

        <!-- Heuristic Panel -->
        <GroupBox Header="Heuristic Mode" Style="{StaticResource GroupBoxMargin}">
            
            <StackPanel Orientation="Vertical">
                
                <Grid Width="150">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="75"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <Label Grid.Row="0" Grid.Column="0" Content="Multiplier:"/>
                    <xctk:IntegerUpDown Grid.Row="0" Grid.Column="1" Value="{Binding HeuristicMultiplier}" Minimum="0" Margin="1" ToolTip="Distance multiplier for the targeted heuristic."/>

                </Grid>
                
            </StackPanel>
            
        </GroupBox>
        
    </StackPanel>

</UserControl>
